<?php

class OwnModule extends fvModule {
	
	function __construct() {
		$moduleName = strtolower ( substr ( __CLASS__, 0, - 6 ) );
		parent::__construct ( fvSite::$fvConfig->get ( "modules.{$moduleName}.smarty.template" ), fvSite::$fvConfig->get ( "modules.{$moduleName}.smarty.compile" ), fvSite::$Layoult );
	}
	
	function showIndex() {
		$LoggedUser = fvSite::$fvSession->get ( "login/loggedUser" );
		if ($LoggedUser) {
			$User = UserManager::getInstance ()->getByPk ( $LoggedUser->getPk() );
			$this->__assign ( array ('AgencyStaff' => $User) );
			return $this->__display ( 'show_infostaff.tpl' );
		} else {
			$Agency = AgencyManager::getInstance ()->getByPk ( $LoggedUser->agency_id );
			$this->__assign ( array ('Agency' => $Agency ) );
			return $this->__display ( 'show_info.tpl' );
		}
	
	}
	
	function showEdit() {
		$LoggedUser = fvSite::$fvSession->get ( "login/loggedUser" );
		$User = UserManager::getInstance ()->getByPk ( $LoggedUser->getPk() );
		$this->__assign ( array (
			'User' => $User,
			'Error' => fvSite::$fvSession->get ( "ERROR" )
		));
		fvSite::$fvSession->set ( "ERROR", NULL );
		return $this->__display ( "show_edit.tpl" );
	}
}
?>